import ptimeApi from '../tool/ptime'
import ResType from './type/ResType.js'
import moment from 'moment'
import {} from '../mongo'
const maxContentLength = 11

// notice: 因为点赞操作可能会非常频繁，所以动弹本身的点赞不再通知提醒
const routes = [
	{
		name: 'ptime系统事件回调',
		path: '/event',
		method: 'post',
		handler: async function ({event, data, ctx}) {
			// console.log(ctx);
			// console.log(ctx.header[`user-agent`])
			// console.dir(data, {depth: 10})
			// if (ctx.header[`user-agent`] == 'ptime.INFO' ) {
			// 	return new ResType(400, '非法请求', null)
			// }
			if (!event || !data) return new ResType(400, '非法请求', null)
			switch (event) {
				case 'commentStore': {
					break
				}
				case 'starStore': {
					break
				}
			}
			return new ResType(0, null, null)
		}
	}
];

function clipcontent (content, limit) {
	if (content.length < limit) return content
	else return `${content.substring(0, limit)}...`
}

export default routes